
function getQueryVariable(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
}

function autoload(){
	if(getQueryVariable("ad")){
		document.getElementById('sendText').value=getQueryVariable("ad") ;
	}
	if(getQueryVariable("submit")){
		setTimeout(function(){CHeck();waitfuc(); }, 1500);
		
		
	}
}



function waitfuc(){
			document.getElementById('btnSend').disabled='true';
			var timeleft = 10
			var counttime = setInterval(function(){ timeleft =timeleft -1;document.getElementById('btnSend').value="请等待"+timeleft;+"miao"; }, 1000);
		
			setTimeout(function(){ clearInterval(counttime); }, 10000);
			setTimeout(endwait, 10000);
		}
		
		function endwait(){
			document.getElementById("btnSend").disabled = "";
			document.getElementById('btnSend').value="发送";
		}
		
		/*
		function waitfuc(){
			document.getElementById('btnSend').style.display='none';
			document.getElementById('wait').style.display='block';
			var timeleft = 10
			var counttime = setInterval(function(){ timeleft =timeleft -1;document.getElementById('wait').innerHTML="请等待"+timeleft;+"miao"; }, 1000);
	
			setTimeout(function(){ clearInterval(counttime); }, 10000);
			setTimeout(endwait, 10000);
		}
		function endwait(){
			document.getElementById('btnSend').style.display='block';
			document.getElementById('wait').style.display='none';
		}
		*/
function CHeck(){
	var e=document.getElementById("sendText");//对象是content
	
			if (e.value != "") {
				
				var str = e.value;
				if(str.includes("@")){
					/*
					if(str.includes("@nCoV.office.gy")){
					window.inputvalue = str.replace('@nCoV.office.gy', '');
					*/
					//swal("请重新输入", "请勿重复点击", "warning");
					/*
					var tide_table_div1 = document.createElement("div");
					tide_table_div1.innerHTML="<span style='font-size:36px; color:red;'><br><h3>包含@</h3><br><h4>您可以重新输入</h4>";
					document.body.appendChild(tide_table_div1);
					swal({
					content: tide_table_div1
					});
					*/
					/*
					javascript:top.location='javascript:alert0();';
					e.select();//选择对象
					document.execCommand("Copy");//执行浏览器复制命令
					*/
				   send();
				}
				else{
					window.inputvalue = str;
					
					e.select();//选择对象
					/*
					document.execCommand("Copy");//执行浏览器复制命令
					*/
					var str = e.value;
					var tide_table_div = document.createElement("div");
					tide_table_div.innerHTML = "<h2>请输入正确的邮箱地址</h2>"+ "<span style='font-size:36px; color:red;'>"+ str + "</span>" +"<br><h3>此邮箱为您的登录账号，请牢记</h3>";
					document.body.appendChild(tide_table_div);
					swal({
					content: tide_table_div
					});;
					/*
					javascript:top.location='javascript:alert0();';
					*/
				}
	
				
			}else{
				//alert("文本框不能为空！");
				swal("文本框不能为空！", "输入邮箱前缀即可 ", "error");
			}
			
	}